home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / edit / xvisrc.zip / QNX.H < prev    next >
C/C++ Source or Header  |  1992-07-28  |  4KB  |  171 lines

  1. /* Copyright (c) 1990,1991,1992 Chris and John Downey */
  2. /***
  3.  
  4. * @(#)qnx.h    2.1 (Chris & John Downey) 7/29/92
  5.  
  6. * program name:
  7.     xvi
  8. * function:
  9.     PD version of UNIX "vi" editor, with extensions.
  10. * module name:
  11.     qnx.h
  12. * module function:
  13.     Definitions for QNX system interface module.
  14. * history:
  15.     STEVIE - ST Editor for VI Enthusiasts, Version 3.10
  16.     Originally by Tim Thompson (twitch!tjt)
  17.     Extensive modifications by Tony Andrews (onecom!wldrdg!tony)
  18.     Heavily modified by Chris & John Downey
  19.  
  20. ***/
  21.  
  22. #include <tcap.h>
  23. #include <stdlib.h>
  24. #include <time.h>
  25. #include <malloc.h>
  26. #include <lfsys.h>
  27. #include <process.h>
  28.  
  29. #ifndef    HELPFILE
  30. #   define    HELPFILE    "/user/local/bin/xvi.help"
  31. #endif
  32.  
  33. /*
  34.  * These are the buffer sizes we use for reading & writing files.
  35.  */
  36. #define SETVBUF_AVAIL
  37. #define    READBUFSIZ    4096
  38. #define    WRTBUFSIZ    4096
  39.  
  40. /*
  41.  * Execute a command in a subshell.
  42.  */
  43. #define    call_system(s)    system(s)
  44.  
  45. /*
  46.  * System-dependent constants.
  47.  */
  48. #define    MAXPATHLEN    79    /* maximum length of full path name */
  49. #define    MAXNAMLEN    16    /* maximum length of file name */
  50. #define    DIRSEPS        "/^"    /*
  51.                  * directory separators within
  52.                  * pathnames
  53.                  */
  54.  
  55. /*
  56.  * Under QNX, characters with the top bit set are perfectly valid
  57.  * (although not necessarily always what you want to see).
  58.  */
  59. #define    DEF_CCHARS    TRUE
  60. #define    DEF_MCHARS    TRUE
  61.  
  62. /*
  63.  * Default file format.
  64.  */
  65. #define DEF_TFF        fmt_QNX
  66.  
  67. #define    Rows        tcap_entry.term_num_rows
  68. #define    Columns        tcap_entry.term_num_cols
  69.  
  70. /*
  71.  * Size of buffer for file i/o routines.
  72.  * The SETVBUF_AVAIL forces the file i/o routines to
  73.  * use a large buffer for reading and writing, and
  74.  * this results in a large performance improvement.
  75.  */
  76. #define SETVBUF_AVAIL
  77. #define BIGBUF        16384
  78.  
  79. /*
  80.  * Macros to open files in binary mode,
  81.  * and to expand filenames.
  82.  */
  83. #define fopenrb(f)    fopen((f),"r")
  84. #define fopenwb(f)    fopen((f),"w")
  85.  
  86. /*
  87.  * Terminal driving functions.
  88.  *
  89.  * Assume TCAP driver.
  90.  */
  91. #define    erase_line()    term_clear(_CLS_EOL)
  92. #define    insert_line()    term_esc(tcap_entry.disp_insert_line)
  93. #define    delete_line()    term_esc(tcap_entry.disp_delete_line)
  94. #define    erase_display()    term_clear(_CLS_SCRH)
  95. #define    invis_cursor()
  96. #define    vis_cursor()
  97.  
  98. #define    cost_goto    8
  99.  
  100. #define    can_ins_line    FALSE
  101. #define    can_del_line    FALSE
  102.  
  103. extern    bool_t        can_scroll_area;
  104. extern    void        (*up_func)(int, int, int);
  105. extern    void        (*down_func)(int, int, int);
  106. #define    scroll_up    (*up_func)
  107. #define    scroll_down    (*down_func)
  108.  
  109. #define tty_linefeed()    putchar('\n')
  110. extern    bool_t        can_scroll_area;
  111. #define    can_inschar    FALSE
  112. #define    inschar(c)
  113.  
  114. /*
  115.  * Colour handling: QNX attributes.
  116.  * These are defined so as to work on both colour and monochrome screens.
  117.  *
  118.  * The colour word contains the following fields:
  119.  *
  120.  *    eBBB_FFF__uihb
  121.  *
  122.  * where:
  123.  *    e    means enable colour
  124.  *    BBB    is the background colour
  125.  *    FFF    is the foreground colour
  126.  *    u    means underline
  127.  *    i    means inverse
  128.  *    h    means high brightness
  129.  *    b    means blinking
  130.  *
  131.  * The colours that may be represented using the three bits of FFF or
  132.  * BBB are:
  133.  *    0    black        4    red
  134.  *    1    blue        5    magenta
  135.  *    2    green        6    yellow
  136.  *    3    cyan        7    white
  137.  *
  138.  * We always set 'e', sometimes 'h' and never 'u', or 'b'.
  139.  * 'i' is set for colours which want to be inverse in monochrome.
  140.  */
  141. #define    DEF_COLOUR    (0x8000 | 0x00 | 0x0700)   /* white on black      */
  142. #define    DEF_SYSCOLOUR    (0x8000 | 0x00 | 0x0700)   /* white on black      */
  143. #define    DEF_STCOLOUR    (0x8000 | 0x06 | 0x6100)   /* bright cyan on blue */
  144. #define    DEF_ROSCOLOUR    (0x8000 | 0x06 | 0x7400)   /* bright white on red */
  145.  
  146. /*
  147.  * Declarations for OS-specific routines in qnx.c.
  148.  */
  149. extern    int        inchar(long);
  150. extern    void        sys_init(void);
  151. extern    void        sys_exit(int);
  152. extern    bool_t        can_write(char *);
  153. extern    bool_t        exists(char *);
  154. extern    int        call_shell(char *);
  155. extern    void        alert(void);
  156. extern    void        delay(void);
  157. extern    void        outchar(int);
  158. extern    void        outstr(char *);
  159. extern    void        flush_output(void);
  160. extern    void        set_colour(int);
  161. extern    void        tty_goto(int, int);
  162. extern    void        co_up(int, int, int);
  163. extern    void        co_down(int, int, int);
  164. extern    void        vt_up(int, int, int);
  165. extern    void        vt_down(int, int, int);
  166. extern    void        sys_startv(void);
  167. extern    void        sys_endv(void);
  168. extern    char        *tempfname(char *);
  169. extern    bool_t        sys_pipe P((char *, int (*)(FILE *), long (*)(FILE *)));
  170. extern    char        *fexpand P((char *));
  171.